package com.lgk.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lgk.domain.User;
import com.lgk.mapper.URMapper;
import com.lgk.service.URService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional
public class URServiceImpl implements URService {

    @Autowired
    private URMapper urMapper;


    //分页查询
    @Override
    public PageInfo<User> getPageUserRole(Integer pageNum, String userName) {
        PageHelper.startPage(pageNum, 6);
        List<User> all = urMapper.getAllUR(userName);
        return new PageInfo<>(all, 5);
    }

    //根据id获取用户角色
    @Override
    public User getById(Integer id) {
        return urMapper.getById(id);
    }

  /*  //按用户名模糊查询
    @Override
    public PageInfo<User> getByUserNamePageUserRole(Integer pageNum, String userName) {
        PageHelper.startPage(pageNum, 6);
        List<User> all = urMapper.getByUserNameAllUR(userName);
        return new PageInfo<>(all, 5);
    }*/
}
